package com.qf.wemedia.controller;

import com.qf.entity.dto.Area;
import com.qf.entity.dto.City;
import com.qf.entity.dto.Province;
import com.qf.service.AreaService;
import com.qf.service.CityService;
import com.qf.service.ProvinceService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("corporation")
public class AddressController {

    @Resource
    ProvinceService provinceService;
    @Resource
    AreaService areaService;
    @Resource
    CityService cityService;

    @RequestMapping("/queryProvince")
    @ResponseBody
    public List<Province> queryProvince(){
        List<Province> list1 = provinceService.queryProvince();
        return list1;
    }
    @RequestMapping("/queryCity")
    @ResponseBody
    public List<City> queryCity(String provinceId){
        List<City> list2 = cityService.queryCity(provinceId);
        return list2;
    }
    @RequestMapping("/queryArea")
    @ResponseBody
    public List<Area> queryArea(String cityId){
        List<Area> list3 = areaService.queryArea(cityId);
        return list3;
    }

}
